package com.xwm93up.basic;

import cn.hutool.extra.spring.SpringUtil;
import com.sun.prism.shader.Solid_TextureYV12_AlphaTest_Loader;
import org.aspectj.weaver.ast.Var;
import org.junit.Test;

/**
 * @Description: desc
 * @Author: xwm93up
 * @Since: 2023/2/23 14:47
 */
public class Test1 {

    @Test
    public void test1 () {
        int a = 5;
        int o = ++a;
        int c = a++;
        int b = 4;
        b += c;
        System.out.println(a);
        System.out.println(c);
        System.out.println(b);
        System.out.println(o);
        // ------------------
        //System.out.println(6&1); //0000 0000
        // System.out.println(6|1); //0000 0111
        /*int a = 10;
        while (a > 5) {
            System.out.println(a);
            a--;
        }

        int b = 10;

        do {
            System.out.println("b===" + b);
            b--;
        }
        while (b > 55);*/

    }

    @Test
    public void test2 () {
        for(int i = 1,j = i + 10;i < 5;i++, j = j * 2){
            System.out.println("i=" + i);

            System.out.println("i=" + i);
        }
    }

    @Test
    public void test3 () {
        Counter counter = new Counter();
        System.out.println(counter);
    }

    @Test
    public void test4 () {
        int[] a1;
        int a2[];
        int array[] = {1,2,4,5};
        int array2[] = {1,2};
    }

    @Test
    public void test5 () {
        int add = add(); //不传参数
        int add2 = add(1); // 传递一个参数
        int add3 = add(2,3); // 传递多个参数
        int add4 = add(new int[] {1,2,3}); // 传递数组

        System.out.println(add4);
    }

    private int add(int... numbers) {
        int sum = 0;
        for (int number : numbers) {
            sum += number;
        }
        return sum;
    }

    @Test
    public void test6() {
        int a = 10, b=20, c=30;
        ++a;
        a++;
        System.out.println("=============");
        int e=++a+(++b)+(c++)+a++;
        System.out.println(e);
    }

    @Test
    public void test7() {
        String str1 = null;
        String str2 = null;
        System.out.println("str1 == str2 ?" + str1 == str2);// false
        System.out.println(null == null); // true
    }
}
